Bitcore-cli XRP updates#4184
Conversation
There was a problem hiding this comment.
Pull request overview
Adds missing XRP functionality across the stack (BWS → BWC → bitcore-cli) to (1) manage XRP AccountSet flags and (2) allow sending XRP with an optional destination tag, plus related CLI UX/help updates and dependency bumps.
Changes:
- Adds XRP account-flag support: BWS
/v1/flagsendpoint + BWC client method + CLI “Flags” advanced menu/command that can create an AccountSet tx. - Adds XRP destination-tag prompting/CLI option support in the transaction flow.
- Updates XRP tx-building to support AccountSet via
txTypeand comma-delimited flag parsing; bumps@clack/promptsand adds Node engine constraint for bitcore-cli.
Reviewed changes
Copilot reviewed 16 out of 18 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/crypto-wallet-core/src/utils/index.ts | Adds normalizeXrpFlag() helper for XRP flag normalization/validation. |
| packages/crypto-wallet-core/src/transactions/xrp/index.ts | Adds txType support (incl. AccountSet) and string flag parsing for XRP transactions. |
| packages/bitcore-wallet-service/src/lib/server.ts | Passes flags into tx proposal creation; adds getFlags() service method. |
| packages/bitcore-wallet-service/src/lib/routes/wallets.ts | Adds authenticated GET /v1/flags route. |
| packages/bitcore-wallet-service/src/lib/model/txproposal.ts | Persists flags on tx proposals. |
| packages/bitcore-wallet-service/src/lib/common/utils.ts | Minor typing/doc fix for strip(). |
| packages/bitcore-wallet-service/src/lib/blockchainexplorers/v8.ts | Adds V8 explorer getFlags() and response-error scrubbing helper. |
| packages/bitcore-wallet-client/src/lib/api.ts | Normalizes outgoing XRP flags; adds getAccountFlags() client method and tx option typings. |
| packages/bitcore-cli/types/wallet.d.ts | Extends wallet typing with XRP getAccountFlags(). |
| packages/bitcore-cli/src/wallet.ts | Implements getAccountFlags() in CLI wallet wrapper. |
| packages/bitcore-cli/src/prompts.ts | Adds promptXrpFlag() multiselect prompt for flag toggling. |
| packages/bitcore-cli/src/commands/transaction.ts | Adds CLI support for --flags and destination --tag, plus XRP tag prompt in interactive flow. |
| packages/bitcore-cli/src/commands/index.ts | Exports new flags command. |
| packages/bitcore-cli/src/commands/flags.ts | New CLI command to view/toggle XRP flags and create AccountSet tx proposals. |
| packages/bitcore-cli/src/cli.ts | Wires flags into the command dispatcher. |
| packages/bitcore-cli/src/cli-commands.ts | Adds “Flags” option to Advanced menu for XRP wallets. |
| packages/bitcore-cli/package.json | Adds Node engine constraint; bumps @clack/prompts. |
| packages/bitcore-cli/package-lock.json | Lockfile updates for the dependency bump and bin name. |
Files not reviewed (1)
- packages/bitcore-cli/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Issue
In direct --command flags flow: getOrSetFlags() calls flags.command(), which delegates to transaction.command() & registers/parses transaction options on the global Commander program. If --flags is provided, it then calls createTransaction(args) while opts.command is still truthy, so createTransaction() calls transaction.command() again and Commander attempts to register the same options twice.
To observe
- Create fresh XRP wallet & fund
- Run with
--command flags --flags tfRequireDestTag - Observe error: "Cannot add option..."
Notes
The first parse in getOrSetFlags() is necessary to read in --flags. So createTransaction() should be flexible enough to not try to parse again.
There was a problem hiding this comment.
Recommendation (confirmed it works) - look for a 'skipCommandParse' flag in the commands/transaction.ts createTransaction() method, and add that :
if (opts.command && !opts.skipCommandParse) {
Object.assign(opts, command(args));
}
Description
Bitcore-CLI is missing some important XRP functionality - namely, sending with a destination tag and setting account flags.
Changelog
Testing Notes
Flagsadvanced option for XRP wallets onlyFlagsshould show you current account flagsFlagsshould allow you to choose account flags to setFlagsshould flow cleanly into the tx creation flow (with account and amount pre set).flagscommand should also show transaction options (e.g.bin/wallet <name> --command flags --help)Sendshould prompt you for an optional destination tag for XRP wallets onlyChecklist